<template>
	<view class="">
		<!-- <u-navbar title-color="#fff" title=" " :background="background" :border-bottom="false" :is-back="false">

		</u-navbar> -->
		
		<view class="p14">
			<u-parse :html="info.content"></u-parse>
		</view>
		
		<view class="fixed-bottom module-btn u-flex" v-if="showEdit">
			<button type="primary" @click="toLogout"
				style="background: #ccc;" class="btn mr10">坚持注销</button>
			<button type="primary" @click="toBack"
				style="background: #70B52C;" class="btn ml10">暂不注销</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showEdit:false,
				info: {},
				
			}
		},
		onLoad(e) {
			this.getInfo(e.id)
			if(e.id==30){
				this.showEdit=true
			}
		},
		onShow() {},

		methods: {
			toBack(){
				uni.navigateBack()
			},
				toLogout() {
			
					this.$common.modelShow('提示', '确认注销账号吗?', () => {
						
						this.$api.deleteUser({}, res => {
							if (res.code == 200) {
								uni.showToast({
									title: '注销成功',
									icon: 'none'
								});
								setTimeout(()=>{
									
									this.$db.clear()
									uni.reLaunch({
										url: '/pages/index/index'
									})
								},1500)
								
							} else {
								uni.showToast({
									title: res.message,
									icon: 'none'
								});
							}
						})
						
					});
			
				},
			getInfo(id){
					this.$api.articleInfo({id}, res => {
						if (res.code == 200) {
							this.info = res.data
						}
					})
			},
		}
	}
</script>

<style lang="scss">
	
		.module-btn {
			.btn {
				border-radius: 16rpx;
				width: 100%;
			}
		}
</style>